Skip to main content

encounter

Table: encounter

The encounter table records interactions or visits between two participants (p1 and p2) in the system.
It captures details about the encounter, including type, timestamps, location, and data entry information.


Columns

Column NameData TypeConstraintsDescription
encounterIdint(11)NOT NULLUnique identifier for the encounter
p1idint(11)NOT NULLParticipant 1 ID (references idmapper)
p2idint(11)NOT NULLParticipant 2 ID (references idmapper)
createdByUserIdint(11)NOT NULLUser who recorded the encounter
dataEntrySourcevarchar(20)NOT NULLSource of data entry (e.g., manual, system)
dateEncounterEnddatetimeNULLTimestamp when the encounter ended
dateEncounterEntereddatetimeNOT NULLTimestamp when the encounter was entered into the system
dateEncounterStartdatetimeNULLTimestamp when the encounter started
detailvarchar(255)NULLAdditional notes or details about the encounter
encounterTypevarchar(30)NOT NULLType of encounter (e.g., visit, call)
locationIdvarchar(12)NULLIdentifier of the location where the encounter occurred

Indexes

  1. PRIMARY - Composite primary key on (encounterId, p1id, p2id)
  2. encounter_p2id_idmapper_mappedId_FK - Index on p2id
  3. encounter_p1id_idmapper_mappedId_FK - Index on p1id
  4. encounter_createdByUserId_user_mappedId_FK - Index on createdByUserId

Foreign Key Relations

  1. encounter_createdByUserId_user_mappedId_FK

    • createdByUserIduser.mappedId
    • Tracks which user recorded the encounter
  2. encounter_p1id_idmapper_mappedId_FK

    • p1ididmapper.mappedId
    • Links participant 1 to the ID mapping system
  3. encounter_p2id_idmapper_mappedId_FK

    • p2ididmapper.mappedId
    • Links participant 2 to the ID mapping system

Usage Notes

  • Captures interactions between two participants for tracking and reporting.
  • dataEntrySource helps differentiate manual vs automated entries.
  • Composite primary key ensures uniqueness for each encounter between two participants.
  • detail field allows storing any extra notes about the encounter.
  • Ensures referential integrity with user and idmapper tables.